package com.twentytwok.hospitalsystem22K.pojo;

import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;

import com.alibaba.fastjson.annotation.JSONField;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * 预约实体类
 * @author Yuanao
 * @date 2021年11月15日02:13:47
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Book implements Serializable {
    /**
     * 预约id
     */
    private Integer id;

    /**
     * 用户id
     */
    private Integer userId;

    /**
     * 医生的id
     */
    private Integer doctorUserId;

    /**
     * 预约时间段的id
     */
    private Integer timeQuantumId;

    /**
     * 预约时的提示信息
     */
    private String message;

    /**
     * 预约费用
     */
    private Double cost;

    /**
     * 订单的日期
     */
    @JSONField(format = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private LocalDate date;

    /**
     * 当前预约的状态表id
     */
    private Integer bookStatusId;

    /**
     * 用户提交预约的时间
     */
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime time;

    /**
     * 是否已经删除
     */
    private Boolean delete;

    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Book other = (Book) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
            && (this.getDoctorUserId() == null ? other.getDoctorUserId() == null : this.getDoctorUserId().equals(other.getDoctorUserId()))
            && (this.getTimeQuantumId() == null ? other.getTimeQuantumId() == null : this.getTimeQuantumId().equals(other.getTimeQuantumId()))
            && (this.getMessage() == null ? other.getMessage() == null : this.getMessage().equals(other.getMessage()))
            && (this.getCost() == null ? other.getCost() == null : this.getCost().equals(other.getCost()))
            && (this.getDate() == null ? other.getDate() == null : this.getDate().equals(other.getDate()))
            && (this.getBookStatusId() == null ? other.getBookStatusId() == null : this.getBookStatusId().equals(other.getBookStatusId()))
            && (this.getTime() == null ? other.getTime() == null : this.getTime().equals(other.getTime()))
            && (this.getDelete() == null ? other.getDelete() == null : this.getDelete().equals(other.getDelete()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
        result = prime * result + ((getDoctorUserId() == null) ? 0 : getDoctorUserId().hashCode());
        result = prime * result + ((getTimeQuantumId() == null) ? 0 : getTimeQuantumId().hashCode());
        result = prime * result + ((getMessage() == null) ? 0 : getMessage().hashCode());
        result = prime * result + ((getCost() == null) ? 0 : getCost().hashCode());
        result = prime * result + ((getDate() == null) ? 0 : getDate().hashCode());
        result = prime * result + ((getBookStatusId() == null) ? 0 : getBookStatusId().hashCode());
        result = prime * result + ((getTime() == null) ? 0 : getTime().hashCode());
        result = prime * result + ((getDelete() == null) ? 0 : getDelete().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", userId=").append(userId);
        sb.append(", doctorUserId=").append(doctorUserId);
        sb.append(", timeQuantumId=").append(timeQuantumId);
        sb.append(", message=").append(message);
        sb.append(", cost=").append(cost);
        sb.append(", date=").append(date);
        sb.append(", bookStatusId=").append(bookStatusId);
        sb.append(", time=").append(time);
        sb.append(", delete=").append(delete);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}